<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="../jquery-1.8.3.min.js"></script>
</head>
<body>
    <h1>JQ AJAX</h1>
    <button id="btn">+</button>
    <hr>
    

    <form action="" id="my">
        数字1: <input type="text" id="num1" name="a">
        数字2: <input type="text" id="num2" name="b">
    </form>

    <hr>
    <div id="box"></div>
    <script>
        $('#btn').click(function(){
            var info = $('#my input').serialize();
            console.log(info);

            // $.get('../php/2.php', info,function(data) {
            //     $('#box').html(data);
            // });
            $.ajax({
                url: '../php/3.php',
                data:info,
                type:'post',
                success: function(data){
                    $('#box').append(data + '<br>');
                },
                error:function() {
                    aleft('AJAX执行失败');
                }
            });
        });
    </script>
</body>
</html>